<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%@taglib prefix="s" uri="/struts-tags"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://"
			+ request.getServerName() + ":" + request.getServerPort()
			+ path + "/";
%>
<html>
	<head>
		<s:head theme="ajax" />

		<title>列出子模块信息</title>
		<link rel="stylesheet" type="text/css" href="../css/counter.css">
		<link rel="stylesheet" type="text/css" href="../css/css.css">
        <script src="<%=basePath%>/javascript/jquery.js"></script>
		<script type="text/javascript" src="../javascript/common.js"></script>

	</head>

	<body>

		<TABLE cellSpacing="0" cellPadding="0" width="100%" align="center"
			border="0">
			<TBODY>
				<TR>
					<TD>
						<IMG src="../images/manage/arron1.gif">
						<FONT class="font_lv">${moduleTitle}</FONT>
						<s:set name="password" value="#session.logininfo.password" />
					</TD>
					<td>
					</td>
				</TR>
			</TBODY>
		</TABLE>


		<TABLE cellSpacing="1" cellPadding="1" width="100%" align="center"
			border="0">
			<tr>
				<td>
					<input class="btn1" type="button" name="query" value="添加子模块"
						onClick="toSearch('save_div');">
					<input class="btn1" type="button" name="return" value="返回一级模块"
						onClick="javascript:location.href='listParentTModule.action';">


				</td>
				<td align="right">
					${pageStr}
				</td>

			</tr>
		</table>


		<TABLE cellSpacing="1" cellPadding="1" width="100%" border="0">

			<TR>
				<TD class=line>
					<table height="100%" cellSpacing=1 cellPadding=2 width="100%"
						bgColor=#CCCCCC border=0>
						<tr>

							<td align="center" background="../images/manage/title_bg.jpg"
								class="font_12_B_w">
								序号
							</td>
							<td align="center" background="../images/manage/title_bg.jpg"
								class="font_12_B_w">
								模块名称
							</td>


							<td align="center" background="../images/manage/title_bg.jpg"
								class="font_12_B_w">
								模块编号
							</td>
							<td align="center" background="../images/manage/title_bg.jpg"
								class="font_12_B_w">
								模块地址
							</td>


							<td align="center" background="../images/manage/title_bg.jpg"
								class="font_12_B_w">
								排序号
							</td>

							<td align="center" background="../images/manage/title_bg.jpg"
								class="font_12_B_w">
								父模块
							</td>
							<td align="center" background="../images/manage/title_bg.jpg"
								class="font_12_B_w">
								操作
							</td>

						</tr>

						<s:iterator value="moduleList" id="bil" status="b">

							<tr bgColor=#FFFFFF>


								<td width="4%" align="center">
									${pageRow+b.count}
								</td>
								<!--<td width="4%"  align="center">
								<s:property value="#b.count" />
						  </td>-->
								<td width="18%" align="left">
									<s:property value="name" />
								</td>
								<td width="18%">
									<s:property value="sn" />
								</td>
								<td width="15%">
									<s:property value="url" />
								</td>


								<td width="7%" align="center">



									<div id=${zlid} >
										<s:property value="orderNum" />
									</div>




								</td>

								<td width="10%" align="center">

									<s:property value="TModule.name" />
								<td width="10%" align="center">

									<a href="#"
										onclick="toModify('modify_div','${id}&${name}&${sn}&${url}&${orderNum}')">
										修改</a>
									<a href="#" onclick="alert_delModule('${id}')">删除</a>
								</td>



							</tr>
						</s:iterator>
					</table>
				</td>
			</tr>
		</table>
		<form name="saveModel" action="saveChildrenTmodule.action" method="post" onsubmit="return toSubmitForm()">
			<DIV id="save_div"
				style="BORDER-RIGHT: #cee6ff 1px outset; BORDER-TOP: #cee6ff 1px outset; LEFT: 15%;  OVERFLOW: hidden; VISIBILITY: hidden; BORDER-LEFT: #cee6ff 1px outset; WIDTH: 500px; BORDER-BOTTOM: #cee6ff 1px outset; POSITION: absolute; TOP: 25%; HEIGHT: 175px; BACKGROUND-COLOR: #eeeeee">
				<table width="100%" cellpadding="0" cellspacing="0"
					bgcolor="#ffffff">
					<tr>
						<td>

							<TABLE height="100%" cellSpacing=1 cellPadding=2 width="100%"
								bgColor=#ffffff border=0>
								<TBODY>
									<TR class=bg height=23>
										<td width="4%" background="../images/manage/title_bg.jpg"
											class="font_12_B_w">
											<IMG src="../images/manage/arron1.gif">
											模块添加
										</TD>
									</TR>
								</TBODY>
							</TABLE>
							<input type="hidden" name="parentId" value="${parentId}"/>
							<TABLE height="100%" cellSpacing=1 cellPadding=2 width="100%"
								bgColor=#ffffff border=0>
								<TR>
									<th bgcolor="#EAEEEE" class="font__12_grey">
										模块名称
									</Th>
									<td bgcolor="#EAEEEE" class="font__12_grey">
										<input type=text name="name" Class="id_kuang" id="moduleName">
									</TD>
									<th bgcolor="#EAEEEE" class="font__12_grey">
										模块编号
									</Th>
									<td bgcolor="#EAEEEE" class="font__12_grey">
										<input name="sn" Class="id_kuang">
									</TD>
								</TR>
								<TR>
									<th bgcolor="#EAEEEE" class="font__12_grey">
										模块地址
									</Th>
									<td bgcolor="#EAEEEE" class="font__12_grey">
										<input name="url" Class="id_kuang" id="moduleAddress">
									</TD>
									<th bgcolor="#EAEEEE" class="font__12_grey">
										排序号
									</Th>
									<td bgcolor="#EAEEEE" class="font__12_grey">
										<input name="orderNum" Class="id_kuang" id="orderNum">
									</TD>
								</TR>

							</TABLE>

							<table width="100%" border="0" cellpadding="0" cellspacing="0"
								bgcolor="#EAEEEE">
								<tr>
									<td>
										<CENTER>
											<input type="submit" name="tj" value="提交">

											&nbsp;&nbsp;
											<input type="button" onClick="toSearch('save_div')" name="qx"
												value="取消">
										</CENTER>
									</td>
								</tr>
							</table>

						</td>
					</tr>
				</table>
			</DIV>
		</form>

		<form name="modifyModel" action="updateChildrenTModule.action"
			method="post">
			<DIV id="modify_div"
				style="BORDER-RIGHT: #cee6ff 1px outset; BORDER-TOP: #cee6ff 1px outset; LEFT: 15%;  OVERFLOW: hidden; VISIBILITY: hidden; BORDER-LEFT: #cee6ff 1px outset; WIDTH: 500px; BORDER-BOTTOM: #cee6ff 1px outset; POSITION: absolute; TOP: 25%; HEIGHT: 175px; BACKGROUND-COLOR: #eeeeee">
				<table width="100%" cellpadding="0" cellspacing="0"
					bgcolor="#ffffff">
					<tr>
						<td>

							<TABLE height="100%" cellSpacing=1 cellPadding=2 width="100%"
								bgColor=#ffffff border=0>
								<TBODY>
									<TR class=bg height=23>
										<td width="4%" background="../images/manage/title_bg.jpg"
											class="font_12_B_w">
											<IMG src="../images/manage/arron1.gif">
											模块修改
										</TD>
									</TR>
								</TBODY>
							</TABLE>
							<input type="hidden" name="id" />
							<input type="hidden" name="parentId" value="${parentId}"/>
							<TABLE height="100%" cellSpacing=1 cellPadding=2 width="100%"
								bgColor=#ffffff border=0>
								<TR>

									<th bgcolor="#EAEEEE" class="font__12_grey">
										模块名称
									</Th>
									<td bgcolor="#EAEEEE" class="font__12_grey">
										<input type=text name="name" Class="id_kuang">
									</TD>
									<th bgcolor="#EAEEEE" class="font__12_grey">
										模块编号
									</Th>
									<td bgcolor="#EAEEEE" class="font__12_grey">
										<input name="sn" Class="id_kuang">
									</TD>
								</TR>
								<TR>
									<th bgcolor="#EAEEEE" class="font__12_grey">
										模块地址
									</Th>
									<td bgcolor="#EAEEEE" class="font__12_grey">
										<input name="url" Class="id_kuang">
									</TD>
									<th bgcolor="#EAEEEE" class="font__12_grey">
										排序号
									</Th>
									<td bgcolor="#EAEEEE" class="font__12_grey">
										<input name="orderNum" Class="id_kuang">
									</TD>
								</TR>

							</TABLE>

							<table width="100%" border="0" cellpadding="0" cellspacing="0"
								bgcolor="#EAEEEE">
								<tr>
									<td>
										<CENTER>
											<input type="submit" name="tj" value="提交">

											&nbsp;&nbsp;
											<input type="button" onClick="toSearch('modify_div')"
												name="qx" value="取消">

										</CENTER>
									</td>
								</tr>
							</table>

						</td>
					</tr>
				</table>
			</DIV>
		</form>
	</body>
	<script type="text/javascript">
	
	 function alert_delModule(id)
	{
		if(confirm("确实要删除该模块吗？")){
		
			window.location="delChildrenTModule.action?id="+id+"&parentId="+${parentId};
			return true;
		}
		else{
			return false;
		}
	}
	function toModify(divName,args)
	{
	  var varArray = args.split("&");
	  var commonPosition=divName.indexOf("_"); 
	  var commonContent=divName.substring(0,commonPosition); 
	  var formName=commonContent+"Model";
	  theVar=eval("document.all[\'"+divName+"\']");
	  theForm=eval("document.all[\'"+formName+"\']");
	  theForm.id.value=varArray[0];
	  theForm.name.value=varArray[1];
	  theForm.sn.value=varArray[2];
	  theForm.url.value=varArray[3];
	  theForm.orderNum.value=varArray[4];
	  if(theVar) {
		if(theVar.style.visibility=='visible')
		{
		   
			theVar.style.visibility = 'hidden';
		}
		else
		{
			theVar.style.visibility = 'visible';
		}
	}
	}
	
	function toSubmitForm()
	{
       	var str=$("#orderNum").val();
       	var re =  /^[0-9]+.?[0-9]*$/;   //判断字符串是否为数字     //判断正整数 /^[1-9]+[0-9]*]*$/   
       	if($("#moduleName").val()=="")
       	{
       	 alert("模块名称不能为空！");
       	 return false;
       	}
       	else if($("#moduleAddress").val()=="")
       	{
       	 alert("模块地址不能为空！");
       	 return false;
       	}
       	else if (!re.test(str)) 
       	{
       	  alert("排序号必须输入数字！");
       	  return false;
       	}
       	return true;
	
	}
	
	</script>
</html>
